<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <title>配置树莓派</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
    <style>
        body {
            background-color: #f4f7fc;
            font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
        }
        .container {
            margin-top: 50px;
            max-width: 800px;
        }
        .card {
            border-radius: 15px;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
            background-color: white;
            padding: 30px;
        }
        textarea {
            resize: vertical;
            min-height: 120px;
        }
        .btn-submit {
            background-color: #007bff;
            color: white;
            border: none;
            padding: 10px 25px;
            border-radius: 5px;
        }
        .btn-submit:hover {
            background-color: #0056b3;
        }
    </style>
</head>
<body>
<div class="container">
    <div class="card">
        <h3 class="text-center mb-4">输入自然语言配置树莓派</h3>

        <!-- Flash 消息显示区域 -->
        {% with messages = get_flashed_messages(with_categories=true) %}
          {% if messages %}
            <div class="mb-3">
              {% for category, message in messages %}
                <div class="alert alert-{{ category }} alert-dismissible fade show" role="alert">
                  {{ message|safe }}
                  <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
                </div>
              {% endfor %}
            </div>
          {% endif %}
        {% endwith %}

        <form action="/submit" method="post">
            <div class="mb-3">
                <label for="instruction" class="form-label">配置指令：</label>
                <textarea class="form-control" name="instruction" id="instruction"
                          placeholder="例如：请把WiFi名设为 mypi，密码为 12345678"></textarea>
            </div>
            <div class="text-center">
                <button type="submit" class="btn-submit">提交</button>
            </div>
        </form>
    </div>
</div>

<!-- Bootstrap JS（用于关闭按钮） -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>
